from selenium import webdriver
from selenium.webdriver.common.by import By
import os
import time

# 打开浏览器,请求测试网址
driver = webdriver.Chrome()
url = 'file:///' + os.path.abspath('html') + '/upload_file.html'
driver.get(url)

# 上传目标文件
time.sleep(3)
file = 'E:\\aweb\geckodriver.log'
driver.find_element(By.NAME, 'file').send_keys(file)

# 退出浏览器
time.sleep(3)
driver.quit()
